//
//  ImageLabelCollectionViewCell.m
//  14-CollectionViewLiWuShuoHomeWork
//
//  Created by 曹曹 on 16/8/2.
//  Copyright © 2016年 曹曹. All rights reserved.
//

#import "ImageLabelCollectionViewCell.h"

@interface ImageLabelCollectionViewCell ()
@property (nonatomic, strong) UIImageView *imageView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *contentLabel;
@property (nonatomic, strong) UILabel *authorLabel;
@end

@implementation ImageLabelCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        CGFloat width = CGRectGetWidth(frame) - 10;
        CGFloat height = CGRectGetHeight(frame);
        _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, width / 2, height)];
        _imageView.backgroundColor = [UIColor orangeColor];
        _imageView.layer.cornerRadius = 4;
        _imageView.layer.masksToBounds = YES;
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(width / 2 + 10, 0, width / 2 - 10, height / 3)];
        _contentLabel = [[UILabel alloc] initWithFrame:CGRectMake(width / 2 + 10, height / 3, width / 2 - 10, height / 3)];
        _authorLabel = [[UILabel alloc] initWithFrame:CGRectMake(width / 2 + 10, height * 2 / 3, width / 2 - 10, height / 3)];
        _titleLabel.text = @"小满生活公社";
        _contentLabel.text = @"更新至第28期";
        _contentLabel.font = [UIFont systemFontOfSize:14];
        _contentLabel.textColor = [UIColor grayColor];
        _authorLabel.text = @"小满";
        _authorLabel.font = [UIFont systemFontOfSize:14];
        _authorLabel.textColor = [UIColor grayColor];
        [self addSubview:_imageView];
        [self addSubview:_titleLabel];
        [self addSubview:_contentLabel];
        [self addSubview:_authorLabel];
    }
    return self;

}
@end
